<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="field[@type = 'text' and parent::doctype]">
		<xsl:variable name="is_new" select="parent::doctype/@action = 'create'"/>
		<xsl:variable name="document_field" select="../../document[@doctype_name = current()/parent::doctype/@name]/field[@name = current()/@name]"/>
		<div class="field">
			<label class="title_label" for="{@name}">
				<xsl:value-of select="@title"/>
				<xsl:text>:&#160;</xsl:text>
				<xsl:if test="@is_important = 1">
					<span class="star">*</span>
				</xsl:if>
			</label>
			<textarea id="{@name}" type="text" name="{@name}" style="height: {@editor_height}px">
				<xsl:choose>
					<xsl:when test="../../pass_info/vars/var[@name = current()/@name]">
						<xsl:value-of select="../../pass_info/vars/var[@name = current()/@name]"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$document_field" />
					</xsl:otherwise>
				</xsl:choose>
			</textarea>
			<xsl:if test="@mode = 'wyswyg'">
				<script type="text/javascript" src="{$prefix}/fckeditor/fckeditor.js"></script>
				<script type="text/javascript">
					//window.onload = function() 
					{
						var oFCKeditor = new FCKeditor('<xsl:value-of select="@name" />');
						oFCKeditor.BasePath = '<xsl:value-of select="$prefix" />/fckeditor/';
						oFCKeditor.Config.EditorAreaCSS = '<xsl:value-of select="$static_prefix" />/css/fck_editorarea.css';
						oFCKeditor.Config.BaseHref = '<xsl:value-of select="$static_prefix" />/';
						oFCKeditor.ToolbarSet = 'IntCMF';
						oFCKeditor.Height = '<xsl:value-of select="@editor_height" />';
						oFCKeditor.ReplaceTextarea();
					}
				</script>
			</xsl:if>
			<xsl:apply-templates mode="dtf_error" select="." />
			<xsl:if test="@comment != ''">
				<div class="comment-">
					<xsl:value-of select="@comment"/>
				</div>
			</xsl:if>
		</div>
	</xsl:template>
</xsl:stylesheet>
